/**************************************************************************************
 * Copyright (C) 2014 NingXia Hope Information Industry Co.,Ltd. All Rights Reserved.
 * 本软件为宁夏希望信息产业有限公司开发研制。未经本公司正式书面同意，其他任何个人、团体
 * 不得使用、复制、修改或发布本软件.
 **************************************************************************************/

package com.prg.util;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.StringWriter;




public class JsonUtil {
     public static void writeJson(HttpServletResponse response,Object object){
         String json = JSON.toJSONStringWithDateFormat(object, "yyyy-MM-dd HH:mm:ss");
         //System.out.println(json);
         try {
             response.setContentType("text/html;charset=utf-8");
             response.getWriter().write(json);
             response.getWriter().flush();
             response.getWriter().close();

         } catch (IOException e) {
             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }

     }


    
}
